package com.fbee.smartcommunities.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fbee.smartcommunities.core.Base;

import java.util.List;

import lombok.*;

/**
 * <p>
 * 权限菜单表
 * </p>
 *
 * @author 汪佳泉
 * @since 2024-08-16
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class Permission extends Base {

    private static final long serialVersionUID = 1L;

    /**
     * 权限名称
     */
    private String name;

    /**
     * 描述
     */
    private String description;

    /**
     * 上级id
     */
    private Long parentId;

    /**
     * 前端导航栏路径
     */
    private String frontUrl;

    /**
     * 后端请求路径
     */
    private String backUrl;

    /**
     * 权限等级
     */
    private Integer level;

    /**
     * 权限类型 1-目录 0-按钮
     */
    private Integer type;

    @TableField(exist = false) // 表明这个字段不是数据库表中的字段
    private List<Permission> children;

    public Permission(Integer id, String name, String description, Long parentId, String frontUrl, String backUrl, Integer level, Integer type, List<Permission> children) {
        super(id);
        this.name = name;
        this.description = description;
        this.parentId = parentId;
        this.frontUrl = frontUrl;
        this.backUrl = backUrl;
        this.level = level;
        this.type = type;
        this.children = children;
    }

    public Permission(String name, String description, Long parentId, String frontUrl, String backUrl, Integer level, Integer type) {
        this.name = name;
        this.description = description;
        this.parentId = parentId;
        this.frontUrl = frontUrl;
        this.backUrl = backUrl;
        this.level = level;
        this.type = type;
    }

    public Permission(Integer id, String name, String description, String frontUrl, String backUrl, Integer type) {
        super(id);
        this.name = name;
        this.description = description;
        this.frontUrl = frontUrl;
        this.backUrl = backUrl;
        this.type = type;
    }


}
